
var page = 0;
var pageShowCount = 6;

var searchText = '';
var provinceCode = '';
var orgId = '';

$(function() {
	showPageResultCallback();
	showethic();
});
/**
 * 项目 start
 * @returns {Boolean}
 */
// 返回数据集合
function showPageResultCallback() {
	$.ajaxq("getPageList", {
		async : false,
		url : '/index/project-search!getPageList.action',
		type : 'post',
		data : {
			"pageIndex" : page,
			"pageShowCount" : pageShowCount,
			"searchText" : searchText,
			"provinceCode" :provinceCode,
			"orgId" :orgId
		},
		dataType : 'json',
		beforeSend : parent.msgLoading,
		complete : parent.successLoading,
		success : function(data) {
			showSearchResultContent(data);
		},
		error : function() {
			alert("对不起，检索超时！");
		}
	});
	return false;
}

// 显示数据集合
function showSearchResultContent(data){
	var resultContent = '';
	if(null!=data){
		$(data).each(function(i) {
			var dataObj = data[i];
			var id = dataObj.id;
	        var name = dataObj.name;
	        var regNumber = dataObj.regNumber;
	        var organizationName = dataObj.organizationName;
	        var createTime = dataObj.createTime;
	        var researchType = dataObj.researchType;
	        
	        name = null==name?"":name;
	        regNumber = null==regNumber?"":regNumber;
	        organizationName = null==organizationName?"":organizationName;
	        createTime = null==createTime?"":createTime;
	        researchType = null==researchType?"":researchType;
	        
	        var detailUrl = "project_detail.jsp?id=" + id;
	        
	        resultContent +=' <li><span>'+createTime.substring(0,10)+'</span><a href="' + detailUrl + '">' + name + '</a></li>';
		});
		if(data==''){
			resultContent+='<li><a href="#">暂无信息</a></li>';
		}
	}else{
		resultContent+='<li><a href="#">暂无信息</a></li>';
	}
	$("#dataArea").html(resultContent);
}
/**
 * 项目结束
 */

/**
 * 备案 start
 */
function showethic() {
	$.ajaxq("getPageList", {
		async : false,
		url : '/ethic_list/ethic-list!getPageList.action',
		type : 'post',
		data : {
			"pageIndex" : page,
			"searchText" : searchText,
			"pageShowCount" : pageShowCount,
			"country" :"",
			"province" : "",
			"state" :"1"
		},
		dataType : 'json',
		beforeSend : parent.msgLoading,
		complete : parent.successLoading,
		success : function(data) {
			showethicContent(data);
		},
		error : function() {
			alert("对不起，检索超时！");
		}
	});
	return false;
}

function showethicContent(data){
	var resultEthicContent = '';
	if(null!=data){	
		$(data).each(function(i) {
			var dataObj = data[i];
			var id = dataObj.id;
	        var name = dataObj.name;
	        var memberName = dataObj.memberName;
	        var organLevel = dataObj.organLevel;
	        var organizationName = dataObj.organizationName;
	        var organType = dataObj.organType;
	        var createTime = dataObj.createTime;
	        name = null==name?"":name;
	        memberName = null==memberName?"":memberName;
	        organLevel = null==organLevel?"":organLevel;
	        organizationName = null==organizationName?"":organizationName;
	        organType = null==organType?"":organType;
	        createTime = null==createTime?"":createTime;
	        
			if(null != memberName && "" != memberName){
				var len = memberName.length;
				memberName = memberName.substring(0,20);
				if(len > 20){
					memberName = memberName +"...";
				}
			}
	        var ethicDetail= "ethic_detail.jsp?id="+id;
	        resultEthicContent +=' <li><span>'+createTime.substring(0,10)+'</span><a href="' + ethicDetail + '">' + name + '</a></li>';
		});
		
		if(data==''){
			resultEthicContent +='<tr><td colspan="5">暂无信息</td></tr>';
		}
	}else{
		resultEthicContent +='<tr><td colspan="5">暂无信息</td></tr>';
	}
	$("#ethicDataArea").html(resultEthicContent);
}
/**
 * 备案 end
 */

